package de.lighti.starcraft.bwapi;

import java.io.File;
import java.io.IOException;

import de.lighti.starcraft.model.StarcraftBot;

public abstract class BWAPI {

    /**
     * Used only for tournaments Tournaments can only be run in RELEASE mode
     */
    protected String tournament;

    /**
     * auto_menu = OFF | SINGLE_PLAYER | LAN | BATTLE_NET for replays, just set
     * the map to the path of the replay file
     */
    protected String auto_menu;
    /**
     * pause_dbg = ON | OFF This specifies if auto_menu will pause until a
     * debugger is attached to the process. Only works in DEBUG mode.
     */
    protected String pause_dbg;
    /**
     * lan_mode = Same as the text that appears in the multiplayer connection
     * list -> Examples: Direct Cable Connection, Local Area Network (UDP),
     * Local PC (UDP)
     */
    protected String lan_mode;
    /**
     * auto_restart = ON | OFF if ON, BWAPI will automate through the end of
     * match screen and start the next match if OFF, BWAPI will pause at the end
     * of match screen until you manually click OK, and then BWAPI resume menu
     * automation and start the next match
     */
    protected String auto_restart;
    /**
     * map = path to map relative to Starcraft folder, i.e. map =
     * maps\(2)Boxer.scm leaving this field blank will join a game instead of
     * creating it The filename(NOT the path) can also contain wildcards,
     * example: maps\(?)*.sc? A ? is a wildcard for a single character and * is
     * a wildcard for a string of characters
     */
    protected String map;
    /**
     * mapiteration = RANDOM | SEQUENCE type of iteration that will be done on a
     * map name with a wildcard
     */
    protected String mapiteration;
    /**
     * enemy_count = 1-7, for 1v1 games, set enemy_count = 1 only used in single
     * player games
     */
    protected String enemy_count;
    /**
     * enemy_race = Terran | Protoss | Zerg | Random | RandomTP | RandomTZ |
     * RandomPZ only used in single player games
     */
    protected String enemy_race;
    /**
     * enemy_race_# = Default -> Values for enemy_race are acceptable, Default
     * will use the value specified in enemy_race
     */
    protected String enemy_race_1;
    /**
     * enemy_race_# = Default -> Values for enemy_race are acceptable, Default
     * will use the value specified in enemy_race
     */
    protected String enemy_race_2;
    /**
     * enemy_race_# = Default -> Values for enemy_race are acceptable, Default
     * will use the value specified in enemy_race
     */
    protected String enemy_race_3;
    /**
     * enemy_race_# = Default -> Values for enemy_race are acceptable, Default
     * will use the value specified in enemy_race
     */
    protected String enemy_race_4;
    /**
     * enemy_race_# = Default -> Values for enemy_race are acceptable, Default
     * will use the value specified in enemy_race
     */
    protected String enemy_race_5;
    /**
     * enemy_race_# = Default -> Values for enemy_race are acceptable, Default
     * will use the value specified in enemy_race
     */
    protected String enemy_race_6;
    /**
     * enemy_race_# = Default -> Values for enemy_race are acceptable, Default
     * will use the value specified in enemy_race
     */
    protected String enemy_race_7;
    /**
     * game_type = TOP_VS_BOTTOM | MELEE | FREE_FOR_ALL | ONE_ON_ONE |
     * USE_MAP_SETTINGS | CAPTURE_THE_FLAG | GREED | SLAUGHTER | SUDDEN_DEATH |
     * TEAM_MELEE | TEAM_FREE_FOR_ALL | TEAM_CAPTURE_THE_FLAG
     */
    protected String game_type;
    /**
     * save_replay = path to save replay to Accepts all environment variables
     * including custom variables. See wiki for more info.
     */
    protected String save_replay;
    /**
     * # of players to wait for in a network game before starting. This includes
     * the BWAPI player. The game will start immediately when it is full.
     */
    protected int wait_for_min_players;
    /**
     * Start immediately when the game has reached # players. This includes the
     * BWAPI player. The game will start immediately when it is full.
     */
    protected int wait_for_max_players;
    /**
     * The time in milliseconds (ms) to wait after the game has met the
     * min_players requirement. The game will start immediately when it is full.
     */
    protected int wait_for_time;
    /**
     * holiday = ON | OFF -> This will apply special easter eggs to the game
     * when it comes time for a holiday.
     */
    protected String holiday;
    /** Control the display of startup warnings */
    protected String show_warnings;
    /** Used to disable shared memory in the Windows Emulator */
    protected String shared_memory;
    /**
     * windowed = ON | OFF -> This causes BWAPI to enter windowed mode when it
     * is injected.
     */
    protected String windowed;
    /** Determines the position of the window */
    protected String left;
    /** Determines the position of the window */
    protected String top;
    /** Determines the width of the client area and not the window itself */
    protected String width;
    /** Determines the height of the client area and not the window itself */
    protected String height;
    /** Game sound engine = ON | OFF */
    protected String sound;
    /** Screenshot format = gif | pcx | tga | bmp */
    protected String screenshots;
    /** The Path of the log file */
    protected String log_path;

    /**
     * Sets the BWAPI variables to their defaults as stated in BWAPI.ini
     */
    protected BWAPI() {
        tournament = "bwapi-data\\TournamentModule.dll";
        auto_menu = "LAN";
        pause_dbg = "OFF";
        lan_mode = "Local Area Network (UDP)";
        auto_restart = "OFF";
        map = null;
        mapiteration = "Random";
        enemy_count = "0";
        enemy_race = "Terran";
        enemy_race_1 = "Default";
        enemy_race_2 = "Default";
        enemy_race_3 = "Default";
        enemy_race_4 = "Default";
        enemy_race_5 = "Default";
        enemy_race_6 = "Default";
        enemy_race_7 = "Default";
        game_type = "MELEE";
        save_replay = "maps\\replays\\%BOTNAME%\\%MAP%_%BOTRACE%vs%ENEMYRACES%.rep";
        wait_for_min_players = 2;
        wait_for_max_players = 8;
        wait_for_time = 60000;
        holiday = "OFF";
        windowed = "ON";
        left = "0";
        top = "0";
        width = "640";
        height = "480";
        sound = "OFF";
        screenshots = "bmp";
        log_path = "bwapi-data\\logs";
        show_warnings = "YES";
        shared_memory = "ON";
    }

    public String getAuto_menu() {
        return auto_menu;
    }

    public String getAuto_restart() {
        return auto_restart;
    }

    public String getEnemy_count() {
        return enemy_count;
    }

    public String getEnemy_race() {
        return enemy_race;
    }

    public String getEnemy_race_1() {
        return enemy_race_1;
    }

    public String getEnemy_race_2() {
        return enemy_race_2;
    }

    public String getEnemy_race_3() {
        return enemy_race_3;
    }

    public String getEnemy_race_4() {
        return enemy_race_4;
    }

    public String getEnemy_race_5() {
        return enemy_race_5;
    }

    public String getEnemy_race_6() {
        return enemy_race_6;
    }

    public String getEnemy_race_7() {
        return enemy_race_7;
    }

    public String getGame_type() {
        return game_type;
    }

    public String getHeight() {
        return height;
    }

    public String getHoliday() {
        return holiday;
    }

    public String getLan_mode() {
        return lan_mode;
    }

    public String getLeft() {
        return left;
    }

    public String getLog_path() {
        return log_path;
    }

    public String getMap() {
        return map;
    }

    public String getMapiteration() {
        return mapiteration;
    }

    public String getPause_dbg() {
        return pause_dbg;
    }

    public String getSave_replay() {
        return save_replay;
    }

    public String getScreenshots() {
        return screenshots;
    }

    public String getShared_memory() {
        return shared_memory;
    }

    public String getShow_warnings() {
        return show_warnings;
    }

    public String getSound() {
        return sound;
    }

    public String getTop() {
        return top;
    }

    public String getTournament() {
        return tournament;
    }

    public int getWait_for_max_players() {
        return wait_for_max_players;
    }

    public int getWait_for_min_players() {
        return wait_for_min_players;
    }

    public int getWait_for_time() {
        return wait_for_time;
    }

    public String getWidth() {
        return width;
    }

    public String getWindowed() {
        return windowed;
    }

    public void setAuto_menu( String auto_menu ) {
        this.auto_menu = auto_menu;
    }

    public void setAuto_restart( String auto_restart ) {
        this.auto_restart = auto_restart;
    }

    public void setEnemy_count( String enemy_count ) {
        this.enemy_count = enemy_count;
    }

    public void setEnemy_race( String enemy_race ) {
        this.enemy_race = enemy_race;
    }

    public void setEnemy_race_1( String enemy_race_1 ) {
        this.enemy_race_1 = enemy_race_1;
    }

    public void setEnemy_race_2( String enemy_race_2 ) {
        this.enemy_race_2 = enemy_race_2;
    }

    public void setEnemy_race_3( String enemy_race_3 ) {
        this.enemy_race_3 = enemy_race_3;
    }

    public void setEnemy_race_4( String enemy_race_4 ) {
        this.enemy_race_4 = enemy_race_4;
    }

    public void setEnemy_race_5( String enemy_race_5 ) {
        this.enemy_race_5 = enemy_race_5;
    }

    public void setEnemy_race_6( String enemy_race_6 ) {
        this.enemy_race_6 = enemy_race_6;
    }

    public void setEnemy_race_7( String enemy_race_7 ) {
        this.enemy_race_7 = enemy_race_7;
    }

    public void setGame_type( String game_type ) {
        this.game_type = game_type;
    }

    public void setHeight( String height ) {
        this.height = height;
    }

    public void setHoliday( String holiday ) {
        this.holiday = holiday;
    }

    public void setLan_mode( String lan_mode ) {
        this.lan_mode = lan_mode;
    }

    public void setLeft( String left ) {
        this.left = left;
    }

    public void setLog_path( String log_path ) {
        this.log_path = log_path;
    }

    public void setMap( String map ) {
        this.map = map;
    }

    public void setMapiteration( String mapiteration ) {
        this.mapiteration = mapiteration;
    }

    public void setPause_dbg( String pause_dbg ) {
        this.pause_dbg = pause_dbg;
    }

    public void setSave_replay( String save_replay ) {
        this.save_replay = save_replay;
    }

    public void setScreenshots( String screenshots ) {
        this.screenshots = screenshots;
    }

    public void setShared_memory( String shared_memory ) {
        this.shared_memory = shared_memory;
    }

    public void setShow_warnings( String show_warnings ) {
        this.show_warnings = show_warnings;
    }

    public void setSound( String sound ) {
        this.sound = sound;
    }

    public void setTop( String top ) {
        this.top = top;
    }

    public void setTournament( String tournament ) {
        this.tournament = tournament;
    }

    public void setWait_for_max_players( int wait_for_max_players ) {
        this.wait_for_max_players = wait_for_max_players;
    }

    public void setWait_for_min_players( int wait_for_min_players ) {
        this.wait_for_min_players = wait_for_min_players;
    }

    public void setWait_for_time( int wait_for_time ) {
        this.wait_for_time = wait_for_time;
    }

    public void setWidth( String width ) {
        this.width = width;
    }

    public void setWindowed( String windowed ) {
        this.windowed = windowed;
    }

    public abstract void writeIni( File location, StarcraftBot thisBot, StarcraftBot otherBot, int iD, boolean isHost ) throws IOException;

}
